﻿<div id="content_wrapper">
	<div id="main_content" class="cf">
		<div class="sepH_c">
<form action="<?php echo site_url($this->uri->uri_string());?>" method="post">
<div class="formEl_a">
	<fieldset class="sepH_b">
		<legend><?php echo lang('admin_system_general')?></legend>
<?php 
foreach ($options as $key=>$option)
{

    echo '<div class="sepH_b">';
	$defValue = $this->option->getOption($key);

    echo '<label for="'.$key.'_a_text" class="lbl_a">'.$option['lang'].'</label>';
    switch ($option['type'])
    {
        case 'select':
            ?>
            <SELECT name="<?php echo $key; ?>">
        		<?php
        				if(is_array($option['options']))
        					foreach($option['options'] as $value =>$text)
        					{
        						$sel = '';
        						if($defValue == $value)
        							$sel = 'SELECTED';
        						echo '<OPTION VALUE="'.$value.'"'.$sel.'>'.$text;
        					}
        		?>
        	</SELECT>
        	<?php 
        	echo form_error($key); 
            break;
        case 'radio':
            if(is_array($option['options'])){
					foreach($option['options'] as $value =>$text){
						$checked = '';
						if($defValue == $value)
							$checked = 'CHECKED';
					?>
					<input type ="radio" id="aradio_<?php echo $key;?>" class="inpt_c" name="<?php echo $key; ?>" value="<?php echo $value; ?>" <?php echo $checked;?>/>					
					<label for="aradio_<?php echo $key;?>" class="lbl_c"><?php echo $text; ?></label>
			<?php 	}				
                }
            break;
        case 'checkbox':
            $defArr = unserialize($defValue);

            if(is_array($option['options'])){
					foreach($option['options'] as $value =>$text){
						$checked = '';
						if(is_array($defArr) && in_array($value,$defArr))
							$checked = 'CHECKED';
					?>
					<input type ="checkbox" id="acheckbox_<?php echo $key;?>" name="<?php echo $key; ?>[]" value="<?php echo $value; ?>" <?php echo $checked;?>/>
					<label for="acheckbox_<?php echo $key;?>" class="lbl_c"><?php echo $text;?>	</label>
			<?php 	}				
                }; 
            break;
        case 'textarea':
            echo '<textarea name="'.$key.'" cols="60" rows="10" >'.$defValue.'</textarea>';
            break;
        default:
            echo '<input class="inpt_a" type ="text" name="'.$key.'" value="'.$defValue.'" size="60" />';
            break;
    }
    echo '<span class="f_help">'.form_error($key).'</span>'; 
    echo '</div>';
}
?>
<button type="submit" class="btn btn_c sepV_a"><span><?php echo lang("submit")?></span></button>
</fieldset>
</div>
</form>
		</div>
	</div>
</div>
<script type="text/javascript">
	head.js(
		"<?php echo js();?>jquery.min.js",
		"<?php echo js();?>jquery.form.js",
		"<?php echo js();?>jquery.microaccordion.js",
		"<?php echo js();?>jquery.stickyPanel.js",
		"<?php echo js();?>xbreadcrumbs.js",
		"<?php echo lib();?>xheditor-1.1.12/xheditor-1.1.12-zh-cn.min.js",
		"<?php echo js();?>xbreadcrumbs.js",
		"<?php echo js();?>lagu.js",
		function(){
			var obj = $('.xheditor');
			if(obj)
				obj.xheditor({height:400,width:650});
		}
	);
</script>